passing structure to functions by value